<template>
	<view class="content">
		<!-- <uv-navbar leftIcon="arrow-leftward" title="看题模式" leftIconColor="#333" placeholder autoBack bgColor="#fff" :titleStyle="titleStyle"></uv-navbar> -->
		<navbar title='答题模式'>
		</navbar>
		<view class="tione">
			<image class="img_ks" src="@/static/new/img_ks.png"></image>
			<!-- <view class="xuan">
				<view class="xuanitem">
					<image class="xuanicon" src="@/static/new/gous.png"></image>
					<text>正常模式</text>
				</view>
				<view class="xuanitem">
					<image class="xuanicon" src="@/static/new/gou.png"></image>
					<text>记忆模式</text>
				</view>
				<view class="xuanitem">
					<image class="xuanicon" src="@/static/new/gou.png"></image>
					<text>随机模式</text>
				</view>
			</view> -->
		</view>
		<view class="line"></view>
		<view class="titwo">
			<view class="xitem " :class="bankinfo.id == item.id?'xactive':''" v-for="(item,index) in bank" :key="index" @click="bankClick(item)">{{item.name}}</view>
		</view>
		<view class="tithree">
			<view class="items " :class="paperinfo.id == item.id?'active':''" v-for="(item,index) in paper" :key="index" @click="paperClick(item)">
				<image class="duigou" src="@/static/new/duigou.png"></image>
				<text class="xname">{{ item.name }}</text>
				<text class="tiname">{{item.topic_number}}题</text>
			</view>
		</view>

		<view class="botview">
			<view class="kaihui" @click="getkaishi">开始练习({{paperinfo.topic_number}}题)</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleStyle:{
					fontWeight: 'bold',
					fontSize: '36rpx',
					color: '#111111',
				},
				value:'',
				bank:[],
				bankinfo:{},
				paper:[],
				paperinfo:{
					topic_number:'',
					id:''
				}

			}
		},
		onLoad() {
			this.gettiClass()
			
		},
		onShow() {
		},
		methods: {
			async gettiClass(){
				let res = await this.$u.api.tibank({
				});
				this.bank = res.bank
				this.bankinfo = res.bank[0]
				this.gettilist()
			},
			async gettilist(){
				let res = await this.$u.api.tipaper({
					bank_id:this.bankinfo.id,
					only_room:''
				});
				this.paper = res.paper
				if(res.paper!=''){
					this.paperinfo = res.paper[0]
				}else{
					this.paperinfo = {
						topic_number:'',
						id:''
					}
				}
				
			},
			getDetail(){
				this.navrouter("/pages/StudPage/Detail");
			},
			bankClick(item){
				this.bankinfo = item
				this.gettilist()
			},
			paperClick(item){
				this.paperinfo = item
			},
			getkaishi(){
				this.gettistart()
			},
			async gettistart(){
				let res = await this.$u.api.tistart({
					paper_id:this.paperinfo.id
				});
				this.navrouter("/pages/StudPage/Exampaper?paper_id="+this.paperinfo.id+'&lei=1');
				// this.test_entry_id = res.test_entry_id
				// this.gettitopic();//考试详情
			},
			
		}
	}
</script>

<style scoped lang="scss">
	.content {
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: 150rpx;
		.tione{
			margin: 30rpx;
			.img_ks{
				width: 100%;
				height: 400rpx;
			}
			.xuan{
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-top: 30rpx;
				.xuanitem{
					display: flex;
					flex-direction: row;
					align-items: center;
					width: 33.33%;
					justify-content: center;
					.xuanicon{
						width: 44rpx;
						height: 44rpx;
						margin-right: 7rpx;
					}
					text{
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 30rpx;
						color: #333333;
					}
				}
			}
		}

		.line{
			height: 20rpx;
			background: #EEEEEE;
			width: 100%;
		}
		.titwo{
			display: flex;
			flex-direction: row;
			align-items: center;
			padding: 30rpx;
			.xitem{
				background: #EEEEEE;
				border-radius: 10rpx;
				padding:15rpx 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: #51565D;
				margin-right: 20rpx;
			}
			.xactive{
				background: #3E65E5;
				color: #fff;
			}
		}
		.tithree{
			margin: 0 30rpx 30rpx;
			.items{
				height: 90rpx;
				background: #EEEEEE;
				border-radius: 10rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 0 30rpx;
				margin-bottom: 20rpx;
				.xname{
					font-weight: 500;
					font-size: 32rpx;
					color: #333333;
				}
				.tiname{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #999999;
					display: inline-block;
					margin-left: auto;
				}
				.duigou{
					width: 44rpx;
					height: 44rpx;
					margin-right: 16rpx;
					display: none;
				}
			}
			.active{
				.duigou{
					display: inline-block;
				}
				background: #EAEFFF;
				.xname{
					color: #3E65E5;
				}
				.tiname{
					color: #3E65E5;
				}
			}
		}
	}
	.botview{
		position: fixed;
		width: 100%;
		height: 120rpx;
		background: #FFFFFF;
		bottom: 0;
		// padding: 0 60rpx;
		display: flex;
		align-items: center;
		border-top: 1rpx solid #eee;
		.kaihui{
			width: 90%;
			margin: 0 auto;
			height: 78rpx;
			background: #3E65E5;
			border-radius: 20rpx;
			display: flex;
			margin-left: auto;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FFFFFF;
		}
	}

</style>